<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Ctype extends Model
{
    //
	protected $table='course_type';
	public function gType(){
			$data = $this->get();
			
			return $data;
	}
	public function getTree($data,$pid){
			$tree = [];
			foreach($data as $k=>$v){	
				if($v['pid'] == $pid){
						$v['child'] = self::getTree($data,$v['id']);
						$tree[] = $v;
				}

			}
			return $tree;
	}
	public function getone($id){
		$data = $this->where("id",$id)->select("id","title")->get();
		return $data;
	}
}
